﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO.IsolatedStorage;
using System.Windows.Media.Imaging;

namespace QuickTasks.ViewModels.Data
{
    public class Common
    {
        public static string getSettingsValue(string keyname)
        {
             string keyvalue = "";
            try
            {
               
                var settings = IsolatedStorageSettings.ApplicationSettings;
                if (settings.Contains(keyname))
                    keyvalue = settings[keyname].ToString();
                return keyvalue;
            }
            catch (Exception ex)
            {
                Exceptions.SaveOrSendExceptions("Exception in getSettingsValue method In Common file", ex);
                return keyvalue;
            }
        }

        public static void saveSettings(string keyname, string keyvalue)
        {
            try
            {
                var settings = IsolatedStorageSettings.ApplicationSettings;
                if (settings.Contains(keyname))
                    settings[keyname] = keyvalue;
                else
                settings.Add(keyname, keyvalue);
                settings.Save();
            }
            catch (Exception ex)
            {
                Exceptions.SaveOrSendExceptions("Exception in saveSettings method In Common file", ex);
            }
        }
        public ImageSource LoadPanoramaLogo()
        {
            BitmapImage panoramalogo = new BitmapImage();
            string path = "/Images/logo.png";
            panoramalogo.UriSource = new Uri(path, UriKind.Relative);
            return panoramalogo;
        }
        public Brush Loadbackground()
        {
            string path = "";

            ImageBrush pivotbackground = new ImageBrush();
            path = "/Images/Pivot/Background.jpg";
            pivotbackground.ImageSource = new BitmapImage(new Uri(path, UriKind.Relative));
            return pivotbackground;
        }

    }
}
